#ifndef __SPRITE_H__
#define __SPRITE_H__

#include <dalelib/v2.h>

static const GLfloat quadVertices[] = { -1.f, -1.f, 1.f, -1.f, 1.f,  1.f, -1.f,  1.f, };
static GLfloat quadTexCoords[] = { 0.f, 1.f, 1.f, 1.f, 1.f, 0.f, 0.f, 0.f, };

void drawSprite(const v2 _Pos=v2(0,0), const v2 _Scale=v2(1,1), const float _Angle=0.f)
{
	glPushMatrix();
	glTranslatef(_Pos.x(),_Pos.y(),0.f);
	glScalef(_Scale.x(),_Scale.y(),0.f);
	glRotatef(_Angle*57.295f,0.f,0.f,1.f);

	glVertexPointer( 2, GL_FLOAT, 0, quadVertices );
	glTexCoordPointer( 2, GL_FLOAT, 0, quadTexCoords );

	glEnableClientState( GL_VERTEX_ARRAY );
	glEnableClientState( GL_TEXTURE_COORD_ARRAY );
	glDrawArrays( GL_TRIANGLE_FAN, 0, 4 );
	glDisableClientState( GL_VERTEX_ARRAY );
	glDisableClientState( GL_TEXTURE_COORD_ARRAY );

	glPopMatrix();
}

#endif
